const inquirer = require('inquirer')
const commander = require('commander')

const { runImg } = require('./image.handler.js')

// runImg('汽车')

const initQuestions = [{
        type: 'checkbox',
        name: 'channels',
        choices: [{
                name: '百度图片',
                value: 'images'
            },
            {
                name: '百度视频',
                value: 'video'
            }
        ]
    },
    {
        type: 'input',
        name: 'keyword',
        message: '请输入想要搜索的关键词？'
    },
    {
        type: 'input',
        name: 'counts',
        message: '请求多少张图片？'
    }
]

inquirer.prompt(initQuestions).then(result => {
    const { keyword, channels, counts } = result
    console.log('result=== ', result)
    for (let channel of channels) {
        switch (channel) {
            case 'images':
                {
                    runImg(keyword, counts)
                    break
                }
        }
    }
})